package com.bdqn.t350.aop;

import com.bdqn.t350.service.UserService;
import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;

import java.util.Arrays;

public class UserServiceLogger {

    Logger logger = Logger.getLogger(UserServiceLogger.class);

    public void before(JoinPoint joinPoint) {
        logger.info("前置增强。。。。。。。。。。。。。。");
        logger.info("调用" + joinPoint.getTarget() + "的" + joinPoint.getSignature().getName()
                + "方法.方法入参:" + Arrays.toString(joinPoint.getArgs()));

    }

    public void afterReturning(JoinPoint joinPoint,Object result){
        logger.info("后置增强。。。。。。。。。。。。。。");
        logger.info("调用" + joinPoint.getTarget() + "的" + joinPoint.getSignature().getName()
                + "方法.方法返回值" + result);
    }
}
